package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class 正则问题 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=110;
       static char chs[];
       static int n,k;
       
       static int dfs(){
    	      int s=0;
    	      while(k<n){
    	    	   if(chs[k]=='('){
    	    		   k++;
    	    		   s+=dfs();
    	    	   }else if(chs[k]=='|'){
    	    		   k++;
    	    		   s=Math.max(s, dfs());
    	    		   return s;
    	    	   }else if(chs[k]=='x'){
    	    		   s++;
    	    		   k++;
    	    	   }else if(chs[k]==')'){
    	    		   k++;
    	    		   break;
    	    	   }
    	      }
    	      return s;
       }
       public static void main(String[] args) throws IOException {
    	      String t=br.readLine();
    	      n=t.length();
		      chs=t.toCharArray();
		      System.out.print(dfs());
	}
}
